package com.freeager.atomikos.test.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.freeager.atomikos.test.mapper.ds2.BalanceLogMapper;
import com.freeager.atomikos.test.model.BalanceLog;
import com.freeager.atomikos.test.service.BalanceLogService;

@Service
public class BalanceLogServiceImpl implements BalanceLogService {

    @Autowired
    private BalanceLogMapper balanceLogMapper;

    @Override
    @Transactional(readOnly = false)
    public Integer addLog(Long userId, Integer type, Integer balance) {
	BalanceLog record = new BalanceLog();
	record.setBalance(balance);
	record.setType(type);
	record.setUserId(userId);
	return balanceLogMapper.insert(record);
    }

}
